import 'package:elevator/model/base_model.dart';
import 'package:elevator/model/group_info.dart';
import 'package:mysql1/src/results/row.dart';

///楼盘 地区 每个楼盘一个独立的 DB 文件，第一个下划线后 4 个字符代表楼盘 ID
class BuildDetail extends BaseModel {
  ///楼盘编号
  String buildId = "";
  ///楼盘名称
  String buildNumber = "";
  ///楼盘名称英文
  String buildNameEn = "";
  ///楼盘名称中文
  String buildNameCn = "";
  ///楼盘地址中文
  String buildAddrCn = "";
  ///楼盘地址英文
  String buildAddrEn = "";

  ///楼盘地址区号
  String buildZoneCn = "";
  ///楼盘地址区号
  String buildZoneEn = "";
  ///楼盘地址子区号
  String buildSubZoneCn = "";
  ///楼盘地址子区号
  String buildSubZoneEn = "";
  ///楼盘类型
  String buildTypeCn = "";
  ///楼盘类型
  String buildTypeZn = "";
  ///楼盘联系人
  String buildContractCn = "";
  ///楼盘联系人
  String buildContractEn = "";
  ///楼盘联系电话
  String buildPhone = "";

  BuildDetail({
      this.buildId  = "",
      this.buildNumber = "",
      this.buildNameEn = "",
      this.buildNameCn = "",
      this.buildAddrCn = "",
      this.buildAddrEn = "",
      this.buildZoneCn = "",
      this.buildZoneEn = "",
      this.buildSubZoneCn = "",
      this.buildSubZoneEn = "",
      this.buildTypeCn = "",
      this.buildTypeZn = "",
      this.buildContractCn = "",
      this.buildContractEn = "",
      this.buildPhone = ""}
      );

  @override
  String getTag() {
    return buildNumber;
  }

  static BuildDetail builder(ResultRow row) {
    ///楼盘编号
    String buildId = row[1].toString();
    ///楼盘名称
    String buildNumber = row[2].toString();
    ///楼盘名称中文
    String buildNameCn = row[3].toString();
    ///楼盘名称英文
    String buildNameEn = row[4].toString();
    ///楼盘地址中文
    String buildAddrCn = row[5].toString();
    ///楼盘地址英文
    String buildAddrEn = row[6].toString();

    ///楼盘地址区号
    String buildZoneCn = row[7].toString();
    ///楼盘地址区号
    String buildZoneEn = row[8].toString();
    ///楼盘地址子区号
    String buildSubZoneCn = row[9].toString();
    ///楼盘地址子区号
    String buildSubZoneEn = row[10].toString();
    ///楼盘类型
    String buildTypeCn = row[11].toString();
    ///楼盘类型
    String buildTypeZn = row[12].toString();
    ///楼盘联系人
    String buildContractCn = row[13].toString();
    ///楼盘联系人
    String buildContractEn = row[14].toString();
    ///楼盘联系电话
    String buildPhone = row[15].toString();
    BuildDetail buildDetail = BuildDetail(buildId:buildId, buildNumber:buildNumber, buildNameEn:buildNameEn, buildNameCn:buildNameCn
        , buildAddrCn:buildAddrCn, buildAddrEn:buildAddrEn, buildZoneCn:buildZoneCn, buildZoneEn:buildZoneEn, buildSubZoneCn:buildSubZoneCn
        , buildSubZoneEn:buildSubZoneEn, buildTypeCn:buildTypeCn, buildTypeZn:buildTypeZn, buildContractCn:buildContractCn, buildContractEn:buildContractEn, buildPhone:buildPhone);
    return buildDetail;
  }
}